<?php
/**
 * 门面模式
 */


interface Facade
{
    public function write();
}

class Redis implements Facade
{
    public function write()
    {
        echo "redis";
    }
}
class Kafka implements Facade
{
    public function write()
    {
        echo "kafka";
    }
}
class File implements Facade
{
    public function write()
    {
        echo "file";
    }
}

class Log
{
    protected $redis;
    protected $kafka;
    protected $file;
    
    public function __construct()
    {
        $this->redis = new Redis();
        $this->kafka = new Kafka();
        $this->file  = new File();
    }
    
    public function redisWriteLog()
    {
        $this->redis->write();
    }
    
    public function kafkaWriteLog()
    {
        $this->kafka->write();
    }
    public function fileWriteLog()
    {
        $this->file->write();
    }
}

$log = new Log();
$log->fileWriteLog();
$log->redisWriteLog();
$log->kafkaWriteLog();
